package com.lfm.improve_;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

@SuppressWarnings({"all"})
public class GenericExercise {
        public static void main(String[] args) {
            HashMap<String, Student> hashMap = new HashMap<>();
            hashMap.put("lfm", new Student("lfm"));
            hashMap.put("xkl", new Student("xkl"));
            hashMap.put("zsf", new Student("zsf"));

            Set<Map.Entry<String, Student>> entry = hashMap.entrySet();
            for (Map.Entry<String, Student> entries : entry) {
                System.out.println(entries.getKey() + "-" + entries.getValue());
            }

            Iterator<Map.Entry<String, Student>> iterator = entry.iterator();
            while (iterator.hasNext()) {
                Map.Entry<String, Student> next = iterator.next();
                System.out.println(next.getKey() + "-" + next.getValue());
            }

        }
}

class Student {
    private String name;

    public Student(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
}